#ifndef __HEAD_H__
#define __HEAD_H__
#pragma once
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <arpa/inet.h>
#include <sys/epoll.h>
using namespace std;

#define ARGS_CHECK(argc, val)       \
    {                               \
        if (argc != val)            \
        {                           \
            printf("error args\n"); \
            return -1;              \
        }                           \
    }
#define ERROR_CHECK(ret, retval, funcName) \
    {                                      \
        if (ret == retval)                 \
        {                                  \
            printf("%d:", __LINE__);       \
            fflush(stdout);                \
            perror(funcName);              \
            return -1;                     \
        }                                  \
    }
#define THREAD_ERROR_CHECK(ret, funcName)               \
    {                                                   \
        if (ret != 0)                                   \
        {                                               \
            printf("%s:%s\n", funcName, strerror(ret)); \
            return -1;                                  \
        }                                               \
    }
#define BUFSIZE 10240
enum
{
    LOGIN_PRE = 1,
    LOGIN_NO,
    LOGIN_POK,
    LOGIN_Q,
    LOGIN_OK,
    REGISTER_PRE,
    REGISTER_NO,
    REGISTER_POK,
    REGISTER_Q,
    REGISTER_OK,
    TOKEN_PLESE,
    OPERATE_Q,
    OPERATE_NO,
    OPERATE_OK,
    LS_Q,
    LS_OK,
    DOWNLOAD_PRE,
    DOWNLOAD_POK,
    DOWNLOAD_Q,
    UPLOAD_PRE,
    UPLOAD_POK,
    UPLOAD_OK,
    UPLOAD_Q,
    DOWN_MORE_PRE,
    DOWN_MORE_POK
};
struct Zhuce
{
    char name[30];
    char passward[100];
    char token[50];
};
struct Train_t
{
    int len;
    int ctl_code;
    char buf[BUFSIZE];
};
struct QUR_msg
{
    char buf[100]; // 第一个存操作，第二个存对象
    char buf1[200];
};
#endif